package com.kinghood.authoritycenter.common.model.dto.authority;

import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.kinghood.sharding.model.KingHoodDefaultSort;
import com.kinghood.sharding.model.KingPageReqDTO;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

/**
 * description
 *
 * @author zhangFanJun
 * @date 2023-12-18 19:50
 **/
@Data
public class MenuQueryPageReqDTO extends KingPageReqDTO implements KingHoodDefaultSort, Serializable {

    public static final String DEFAULT_COLUMN0 = "level";
    public static final String DEFAULT_COLUMN1 = "sort";
    public static final String DEFAULT_Tail = "updateTime";

    @Override
    public List<OrderItem> getDefaultSort() {
        OrderItem one = OrderItem.asc(DEFAULT_COLUMN0);
        OrderItem two = OrderItem.asc(DEFAULT_COLUMN1);
        return Arrays.asList(one,two);
    }

    @Override
    public List<OrderItem> getTailSort() {
        OrderItem one = OrderItem.desc(DEFAULT_Tail);
        return Collections.singletonList(one);
    }

    /**
     * null的时候为根目录
     * */
    private Long parentId;
    /**
     * 归属类型（0：组织中心，1，商品中心）
     */
    @NotNull(message = "归属类型必填")
    private Integer belongType;


}
